sea of btc app

by: Aman Sharma, 7 years ago


/code below
def rsiIndicator(priceData,location="top"):
        if location == "top":
            values = {'key':1, "prices": priceData, "periods":topIndicator[1]}
        elif location == "bottom":
            values = {'key':1, "prices": priceData, "periods":bottomIndicator[1]}

        url = "http://seaofbtc.com/api/indicator/rsi"

        data = urllib.parse.urlencode(values)
        data = data.encode("utf-8")

        req = urllib.request.Request(url,data)
        resp = urllib.request.urlopen(req)

        respData = resp.read()

        newData = str(respData).replace("b","").replace(']','').replace("'",'')
        priceList = newData.split(', ')
        rsiData = [float(i) for i in priceList]

        print("call!!!")


        if location == "top":
            a0.plot_date(OHLC['MPLDates'], rsiData, lightColor, label="RSI")
            datLabel = "RSI("+str(topIndicator[1])+")"
            a0.set_ylabel(datLabel)

        if location == "bottom":
            a3.plot_date(OHLC['MPLDates'], rsiData, lightColor, label="RSI")
            datLabel = "RSI("+str(topIndicator[1])+")"
            a3.set_ylabel(datLabel)
              /
it  failed  and could not convert string to float.
help me to fix this .
I also try to use  bitfinex api but it gives a blank graph as i think that bitfinex api is upgraded  and need key for accessing.Please give me some suggestion to improve bitfinex api code.                



You must be logged in to post. Please login or register an account.